<!--/*
 * 自己做的一个商品添加
 */-->
<?php	namespace Common\Model;
use Hdphp\Model\Model;
class Shop extends Model
{
	protected $table = 'shop';
	protected $validate = array(
		array('sname','required','名称不能为空',3,3),
		array('unit','required','单位不能为空',3,3),
	);
	protected $auto = array(
		array('grounding','time','function',3,1),
		array('thumb','image','method',3,3),
	);
	protected function image()
	{
		$path = 'Upload/thumb/'.date('ymd');
//		p($path);
		$file = Upload::type('jpg,png,gif')->path($path)->size(2000000)->make();
		foreach ($file as $k => $v) {
			$files[] = $v['path'];
		}
		$files = implode(',', $files);
		return $files;
	}
	public function store()
	{
		if(!$this->create()) return false;
		$_POST['sendtime'] = time();
//		p($_POST);die;
		return $this->add();
	}
}
